package com.example.springboot.service;

import com.example.springboot.entity.Wine;
import com.example.springboot.mapper.WineMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WineService {
    @Autowired
    WineMapper wineMapper;


    public void insertWine(Wine wine) {
        wineMapper.insert(wine);
    }

    public void updateWine(Wine wine) {
        wineMapper.updateWine(wine);
    }

    public void deleteWine(Integer id) {
        wineMapper.deleteWine(id);
    }

    public void batchDeleteWine(List<Integer> ids) {
        for(Integer id : ids) {
            wineMapper.deleteWine(id);
        }
    }

    public List<Wine> selectAll() {
        return wineMapper.selectAll();
    }

    public Wine selectById(Integer id) {
        return wineMapper.selectById(id);
    }

    public List<Wine> selectByName(String name) {
        return wineMapper.selectByName(name);
    }


}
